home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / src / tla_source.lha / tla_demo.s < prev    next >
Text File  |  1998-01-16  |  9KB  |  416 lines

  1.  
  2. ; +-------------------------------+
  3. ; |                               |
  4. ; | EXPERIENCE: T.L.A.            |
  5. ; |  (19.07.97)                   |
  6. ; |                               |
  7. ; +-------------------------------+-------------------------------------------+
  8.  
  9.  
  10.     MACHINE    68000
  11.     Jmp    Start
  12.     Dc.b    'EXPERIENCE Demo 1.0 (12.7.97)',0
  13.     EVEN
  14.  
  15. ;+-----------+
  16. ;| CONSTANTS |
  17. ;+-----------+--------------------------------+
  18.  
  19. TRUE        = -1
  20. FALSE        =  0
  21. DS_MINPROC    =  68020            ; Minimum 68020 Processor
  22. DS_AGAMODE    =  TRUE                ; Needs AGA?
  23.  
  24.  
  25. ;+----------+
  26. ;| INCLUDES |
  27. ;+----------+---------------------------------+
  28.  
  29.     MACHINE    DS_MINPROC
  30.     include    'demo.i'            ; All the crap needed!!
  31.  
  32.  
  33. ;--+------------------+
  34. ;--| CODE STARTS HERE |
  35. ;--+------------------+-------------------------------------------------------+
  36.  
  37.     MACHINE 68000                ; So it wont die on 68000
  38.  
  39. Start
  40.     ;--( Open Libraries )--
  41.     _OpenLibrary    graphics
  42.     _OpenLibrary    dos
  43.  
  44.     ;--( Do Hardware Check )--
  45.     Bsr    Diag            ; Do a system diagnosis to CLI
  46.     Beq.s    _no_hw            ;  H/W not good enough for some reason
  47.  
  48.     MACHINE    DS_MINPROC
  49.  
  50.     ;--+------------------+--
  51.     ;--| Politely Kill OS |--
  52.     ;--+------------------+--
  53.  
  54.     _FlushView                ; No Display Now
  55.     Call    _LVOForbid,exec            ; No multitasking either
  56.  
  57.     ;-- KILL THE DMA --
  58.     _WaitVBL
  59.  
  60.     Lea    $DFF000,a5
  61.     Move.w    DMACONR(a5),WB_DMACON
  62.     Move.w    #$07FF,DMACON(a5)
  63.     Or.w    #$8000,WB_DMACON        ; SETIT
  64.  
  65.     Move.l    HW_VBR(pc),a0
  66.     Move.l    $6C(a0),HW_INT3            ; Save Old Lev3 Interrupt
  67.  
  68.   ; ***********************************************************************
  69.   ; ** We can do what we want to the hardware now without disturbing the **
  70.   ; **  OS too much, so be prepared for some NASTY coding from now on!!  **
  71.   ; ***********************************************************************
  72.  
  73.     ;--+------------------+--
  74.     ;--| Initialise Music |--
  75.     ;--+------------------+--
  76.  
  77.     Move.w    #$8200,DMACON(a5)
  78.     Lea    IntroMod,a0            ; ** Start Intro Mod **
  79.     Jsr    PT_Init
  80.  
  81.     Lea    Int3,a0
  82.     Bsr    AddInt3                ; Enable Our Interrupt
  83.  
  84.  ; +-<||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||>-+
  85.  
  86.     Move.w    #$0000,COL00(a5)
  87.  
  88.     ;-- CHUNKY INITIALISATION --
  89.     Lea    CHUNKY,a0
  90.     Jsr    prec_chk_table
  91.  
  92.     ;-- DEMO EFFECTS --
  93.  
  94.     Jsr    INT_INT                ; The Intro
  95.     Tst.w    EXIT
  96.     Bne.s    .ende
  97.  
  98.     ; +-------------------+
  99.     Lea    MainMod,a0            ; ** Main Module Now ***
  100.     Jsr    PT_Init
  101.     ; +-------------------+
  102.  
  103.     Jsr    TNL_INT                ; Tunnel
  104.     Tst.w    EXIT
  105.     Bne.s    .ende
  106.  
  107.     Jsr    LNS_INT
  108.     Tst.w    EXIT
  109.     Bne.s    .ende
  110.  
  111.     Jsr    YIN_INT                ; Yin-Yang Bunpmap
  112.     Tst.w    EXIT
  113.     Bne.s    .ende
  114.  
  115.     Jsr    TRI_INT                ; Siperpinski Triangle
  116.     Tst.w    EXIT
  117.     Bne.s    .ende
  118.  
  119.     Jsr    PIC_INT                ; EXP raytraced
  120.     Tst.w    EXIT
  121.     Bne.s    .ende
  122.  
  123.     Jsr    LNS2_INT                ; Lens Effect
  124.     Tst.w    EXIT
  125.     Bne.s    .ende
  126.  
  127.  
  128.     ; +-------------------+
  129.     ; FADE OUT MOD
  130.  
  131.     Move.w    #63,d0
  132. .fmlp    _WaitVBL 2
  133.     Move.w    d0,d1
  134.  
  135.     Move.l    d0,-(sp)
  136.     Jsr    PT_SetMasterVol
  137.     Move.l    (sp)+,d0
  138.  
  139.     Dbra    d0,.fmlp
  140.  
  141.     ; RESET VOLUME
  142.     Move.w    #63,d0
  143.     Move.w    d0,d1
  144.     Jsr    PT_SetMasterVol
  145.  
  146.     ; +-------------------+
  147.     ; PLAY LAST MOD
  148.     Lea    EndMod,a0
  149.     Jsr    PT_Init
  150.     ; +-------------------+
  151.  
  152.     Jsr    ECD_INT
  153. ;    Tst.w    EXIT
  154. ;    Bne.s    .ende
  155.  
  156. .ende
  157.  ; +-<||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||>-+
  158.  
  159.  
  160.  
  161.     ;-- Demo Is Now Considered Finished --
  162.     Lea    $DFF000,a5
  163.     Move.l    HW_VBR(pc),a0
  164.     Move.l    HW_INT3(pc),$6C(a0)        ; Old VBlank Interrupt
  165.  
  166.     Jsr    PT_End
  167.  
  168.     ;-- Restore OS To Former Glory --
  169.     Move.w    WB_DMACON(pc),DMACON(a5)
  170.  
  171.   ; ****************************************************************************
  172.   ; ** From now on we have to be nice to the OS, since things are nearly back **
  173.   ; ** to normal. Back to OS friendly code (OS's inteerupts are restored)     **
  174.   ; ****************************************************************************
  175.  
  176.  
  177.     _RestoreView                ; WB's Display is back!
  178.                         ;  + Multitask (WaitTOF's)
  179.  
  180.     ;-- Close Libs & shit like that --
  181.  
  182.     MACHINE    68000
  183. _no_hw    _CloseLibrary    dos
  184.     _CloseLibrary    graphics
  185.     Moveq    #0,d0
  186.     Rts                    ; To the realms of AmigaDOS ;^)
  187.  
  188.  
  189.  
  190. ; +-------------+
  191. ; | SUBROUTINES |
  192. ; +-------------+-------------------------------------------------------------+
  193.  
  194.  
  195.     MACHINE    68010
  196. GrabVBR    Move.l    d0,-(sp)
  197.     Movec    VBR,d0
  198.     Move.l    d0,HW_VBR
  199.     Move.l    (sp)+,d0
  200.     Rte
  201.  
  202.  
  203.     MACHINE    68000
  204. Diag    Movem.l    d1-7/a0-6,-(sp)
  205.     Lea    TD_VALS,a2
  206.  
  207.     ;-- CPU Check --
  208.     _CheckCPU
  209.     Move.w    d0,(a2)+
  210.  
  211.     ;-- AGA Check --
  212.     Move.w    $DFF07C,d0        ; LISAID
  213.     Cmp.b    #$F8,d0
  214.     Bne.s    .noaga
  215.  
  216.     Move.l    #TT_AGAY,(a2)+            ; Apparently AGA
  217.     Move.w    #-1,HW_AGA
  218.     Bra.s    .agafin
  219.  
  220. .noaga    Move.l    #TT_AGAN,(a2)+            ; Not AGA
  221.     Move.w    #00,HW_AGA
  222. .agafin    
  223.     ;-- Mem Checks --
  224.     LibBase    exec
  225.     Move.l    #2,d1            ; Chip
  226.     Call    _LVOAvailMem
  227.     Move.l    d0,(a2)+
  228.     Move.l    #$80002,d1        ; Total Chip
  229.     Call    _LVOAvailMem
  230.     Move.l    d0,(a2)+
  231.     Move.l    #4,d1            ; Fast
  232.     Call    _LVOAvailMem
  233.     Move.l    d0,(a2)+
  234.     Move.l    #$80004,d1        ; Total Fast
  235.     Call    _LVOAvailMem
  236.     Move.l    d0,(a2)+
  237.  
  238.     ;-- Get VBR --
  239.     Tst.w    HW_CPU            ; Is Processor A '000 ?
  240.     Beq.s    .novbr            ;  Yes -> No VBR on an '000 !!
  241.     Lea    GrabVBR(pc),a5
  242.     Call    _LVOSupervisor
  243.  
  244.     ;-- Display Results --
  245. .novbr    _PutCLI    TT_DIAA            ; Title Bit
  246.     _PutCLI    TT_DIAB, TD_VALS    ; Hardware Bit
  247.  
  248.     ;--Last Microsecond Checks --
  249.     IFNE DS_AGAMODE
  250.      Tst.w    HW_AGA
  251.      Beq.s    .d_fail            ; No AGA - Can't run
  252.     ENDC
  253.     Cmp.w    #(DS_MINPROC-68000)/10,HW_CPU        ; ;^)
  254.     Blt.s    .d_fail            ; Processor not good enough
  255.  
  256. ;d_okay    ;-- We're OK now --
  257.     _PutCLI    TT_DIAC            ; Everything's OK to run demo
  258.     Movem.l    (sp)+,d1-7/a0-6
  259.     Moveq    #-1,d0                    ; Return -1 = OK
  260.     Rts
  261.  
  262. .d_fail    ;-- Whoa! Something's not right! --
  263.     _PutCLI    TT_DIAD
  264.     Movem.l    (sp)+,d1-7/a0-6
  265.     Moveq    #0,d0                    ; Return  0 = FAIL!
  266.     Rts
  267.  
  268.  
  269.  
  270. ;-- AddInt3 - A0.l = Int3 Address
  271.  
  272.     MACHINE    DS_MINPROC
  273. AddInt3    Move.l    HW_VBR,a1
  274.     Move.l    a0,$6C(a1)
  275.     Move.w    #$C020,$DFF000+INTENA
  276.     Rts
  277.  
  278.  
  279. ;+------------------+
  280. ;| VBLANK INTERRUPT |
  281. ;+------------------+---------------------------------------------------------+
  282.  
  283. Int3    Movem.l    d0-7/a0-6,-(sp)
  284.  
  285.     Jsr    PT_Music            ; Oi! TrackerPlayer
  286.  
  287.     Add.w    #1,INT_Timer1            ; General Timers
  288.     Add.w    #1,INT_Timer2
  289.  
  290.     Btst    #6,$BFE001
  291.     Bne.s    .nolmb
  292.     Move.w    #-1,EXIT            ; User wants to exit!!
  293.  
  294. .nolmb    Movem.l    (sp)+,d0-7/a0-6
  295.     Move.w    #$0020,$DFF000+INTREQ        ; Have dealt with VBL interrupt
  296.     Nop
  297.     Rte
  298.  
  299.  
  300. ; +---------------------------------------------------------------------------+
  301.  
  302.     include    'CNK_2x1_INI.s'
  303.     include    'CNK_2x1_32.s'
  304.     include    'CNK_2x1_16.s'
  305.  
  306.  
  307.  
  308.  
  309.  
  310. ;+--------------+
  311. ;| DATA SECTION |
  312. ;+--------------+-------------------------------------------------------------+
  313.  
  314.     Library    graphics
  315.     Library    dos
  316.  
  317.  
  318.     ; +-----------------------------------+
  319.  
  320. WB_DMACON    Dc.w 0
  321.  
  322.  
  323. TD_VALS                        ; Text Data Values Follow...
  324.  
  325. HW_CPU    Dc.w 0                    ; CPU # (0,1,2,3,4)
  326.     Dc.l 0                    ; Ptr -> TT_AGAx
  327. HW_CHIP    Dc.l 0,0                ; Chip RAM free (total)
  328. HW_FAST    Dc.l 0,0                ; Fast RAM free (total)
  329. HW_VBR    Dc.l 0                    ; VBR Address (if any)
  330.  
  331. HW_AGA    Dc.w 0                    ; Boolean: 0 - FALSE, -1 - TRUE
  332. HW_INT3    Dc.l 0                    ; Addr Of OS Vblank Int.
  333.  
  334.  
  335.  
  336.     ; +--| GLOBALS |----------------------+
  337.  
  338. INT_Timer1    Dc.w    0            ; Updated by VBL interrupt
  339. INT_Timer2    Dc.w    0            ; "
  340. EXIT        Dc.w    0            ; Subprogs set to nonzero if immediate quit
  341.  
  342.     CNOP    0,4
  343.  
  344. PAL_black    Dcb.l    256,$000000
  345. PAL_white    Dcb.l    256,$FFFFFF
  346. PAL_temp    Dcb.l    256,$000000
  347.  
  348.     ; +-----------------------------------+
  349.  
  350.  
  351. TT_DIAA    Dc.b $0A,$1B,'[4m',$1B,'[44m'
  352.     Dc.b 'EXPeRIeNCe! System check V1.00'
  353.     Dc.b $1B,'[0m',$1B,'[40m',$0A,$0A,$00
  354.  
  355. TT_DIAB    Dc.b 'CPU  : 680%d0',$0A
  356.     Dc.b 'AGA  : %s',$0A
  357.     Dc.b 'CHIP : %ld (%ld)',$0A
  358.     Dc.b 'FAST : %ld (%ld)',$0A
  359.     Dc.b 'VBR  : $%lx',$0A,$00
  360.  
  361. TT_DIAC    Dc.b $1B,'[4m'
  362.     Dc.b '                              ',$1B,'[0m',$0A,$0A
  363.     Dc.b 'Running production...',$0A,$0A,$00
  364.  
  365. TT_DIAD    Dc.b $0A,"** YOUR HARWARE'S NOT GOOD ENOUGH! **",$0A,$0A,$00
  366.  
  367.  
  368. TT_AGAY    Dc.b 'Yes',$00
  369. TT_AGAN    Dc.b 'No',$00
  370.  
  371. ; +---------------------------------------------------------------------------+
  372.  
  373.     section 'mod',DATA_C
  374. IntroMod    incbin    'TLA/mod.Eps_TLA-Intro'
  375.         Ds.b    64            ; Avoid PT_Replayer bug !! (SafetyBuffer)
  376. MainMod        incbin    'TLA/mod.Eps_TLA-Main'
  377.         Ds.b    64
  378. EndMod        incbin    'TLA/mod.Eps_tla-end'
  379.         Ds.b    64
  380.  
  381. ; +---------------------------------------------------------------------------+
  382.  
  383.     section    'ChunkyBuffer',BSS
  384. CHUNKY    Ds.b    1024*1024
  385.  
  386.  
  387. ; +----------------------+
  388. ; | Other Included Stuff |
  389. ; | (The Demo Bits)      |
  390. ; +----------------------+----------------------------------------------------+
  391.  
  392.     section    'Intro',CODE
  393.     include    'TLA/Intro/intro.s'
  394.  
  395.     section    'Lens',CODE
  396.     include    'TLA/l